home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWGadgts / Sources / FWCntrHW.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  21.9 KB  |  661 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWCntrHW.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifdef FW_BUILD_WIN
  11.  
  12. #include "FWFrameW.hpp"
  13.  
  14. #ifndef FWHIDNFR_H
  15. #include "FWCntrHW.h"
  16. #endif
  17.  
  18. #ifndef FWSCLBAR_H
  19. #include "FWSclBar.h"
  20. #endif
  21.  
  22. #ifndef FWPUSHBU_H
  23. #include "FWPushBu.h"
  24. #endif
  25.  
  26. #ifndef FWRADIOB_H
  27. #include "FWRadioB.h"
  28. #endif
  29.  
  30. #ifndef FWCLUSTR_H
  31. #include "FWClustr.h"
  32. #endif
  33.  
  34. #ifndef FWFRAME_H
  35. #include "FWFrame.h"
  36. #endif
  37.  
  38. // ----- OS Includes -----
  39.  
  40. #ifndef FWPOINT_H
  41. #include "FWPoint.h"
  42. #endif
  43.  
  44. #ifndef FWCFMRES_H
  45. #include "FWCFMRes.h"
  46. #endif
  47.  
  48. //========================================================================================
  49. // Global declarations
  50. //========================================================================================
  51.  
  52. WORD WM_ODFGETOBJECT = ::RegisterWindowMessage("Apple:Framework:GetObject");
  53.  
  54. //========================================================================================
  55. // CLASS FW_CPrivWinControlHelper
  56. //========================================================================================
  57.  
  58. FW_DEFINE_CLASS_M0(FW_CPrivWinControlHelper)
  59.  
  60. //----------------------------------------------------------------------------------------
  61. // FW_CPrivWinControlHelper::FW_CPrivWinControlHelper
  62. //----------------------------------------------------------------------------------------
  63.  
  64. FW_CPrivWinControlHelper::FW_CPrivWinControlHelper(Environment* ev,
  65.                                                     const FW_CClassInfo& classInfo,
  66.                                                    FW_CGadget* gadget) :
  67.     fGadget(gadget),
  68.     fHWnd(NULL)
  69. {
  70.     CheckForInitialize(ev, classInfo);
  71. }
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // FW_CPrivWinControlHelper::~FW_CPrivWinControlHelper
  75. //----------------------------------------------------------------------------------------
  76.  
  77. FW_CPrivWinControlHelper::~FW_CPrivWinControlHelper()
  78. {
  79.     ::DestroyWindow(fHWnd);
  80. }
  81.  
  82. //----------------------------------------------------------------------------------------
  83. // FW_CPrivWinControlHelper::CheckForInitialize
  84. //----------------------------------------------------------------------------------------
  85.  
  86. void FW_CPrivWinControlHelper::CheckForInitialize(Environment* ev, const FW_CClassInfo& classInfo)
  87. {
  88.     if (classInfo == FW_TYPEID_FROM_POINTER(this))
  89.         this->Initialize(ev);
  90. }
  91.  
  92. //----------------------------------------------------------------------------------------
  93. // FW_CPrivWinControlHelper::Initialize
  94. //----------------------------------------------------------------------------------------
  95.  
  96. void FW_CPrivWinControlHelper::Initialize(Environment* ev)
  97. {
  98.     RegisterSuperClass(GetSuperClassInfo());
  99.     
  100.     FW_SPlatformPoint wndLocation;
  101.     fGadget->GetLocation(ev).AsPlatformPoint(wndLocation);
  102.     FW_SPlatformPoint wndSize;
  103.     fGadget->GetSize(ev).AsPlatformPoint(wndSize);
  104.     
  105.     fHWnd = CreateHWnd(fGadget->GetFrame(ev)->GetShadowWindow(ev), wndLocation, wndSize);
  106. }
  107.  
  108. //----------------------------------------------------------------------------------------
  109. // FW_CPrivWinControlHelper::RegisterSuperClass
  110. //----------------------------------------------------------------------------------------
  111.  
  112. FW_Boolean FW_CPrivWinControlHelper::RegisterSuperClass
  113.         (FW_SPrivWinSuperClassInfo& superClassInfo)
  114. {
  115.     
  116.     FW_Boolean success = FALSE;
  117.     WNDCLASS wc;
  118.     
  119.     if (::GetClassInfo(NULL, superClassInfo.fClassName, &wc))
  120.         success = TRUE;
  121.     else if (::GetClassInfo(NULL, superClassInfo.fOldClassName, &wc))
  122.     {
  123.         superClassInfo.fOldWndProc = wc.lpfnWndProc;
  124.         superClassInfo.fWndExtraBytes = wc.cbWndExtra;
  125.  
  126.         wc.hInstance = FW_gInstance;
  127.         wc.lpszClassName = superClassInfo.fClassName;
  128.         wc.lpfnWndProc = superClassInfo.fWndProc;
  129.         wc.cbWndExtra = superClassInfo.fWndExtraBytes + sizeof(void *);
  130.         wc.style |= CS_GLOBALCLASS;
  131.  
  132.         success = ::RegisterClass(&wc);
  133.     }
  134.     
  135.     if (!success)
  136.         FW_DEBUG_MESSAGE("Unable to register Windows class!");
  137.         
  138.     return success;
  139. }
  140.  
  141. //----------------------------------------------------------------------------------------
  142. // FW_CPrivWinControlHelper::Move
  143. //----------------------------------------------------------------------------------------
  144.  
  145. void FW_CPrivWinControlHelper::Move(const FW_SPlatformPoint& location,
  146.                                      const FW_SPlatformPoint& size)
  147. {
  148.     ::MoveWindow(fHWnd, location.x, location.y, size.x, size.y, TRUE);
  149. }
  150.  
  151. //----------------------------------------------------------------------------------------
  152. // FW_CPrivWinControlHelper::SetText
  153. //----------------------------------------------------------------------------------------
  154.  
  155. void FW_CPrivWinControlHelper::SetText(const FW_CString& text)
  156. {
  157.     ::SetWindowText(fHWnd, text);
  158. }
  159.  
  160. //----------------------------------------------------------------------------------------
  161. // FW_CPrivWinControlHelper::GetText
  162. //----------------------------------------------------------------------------------------
  163.  
  164. void FW_CPrivWinControlHelper::GetText(FW_CString& text) const
  165. {
  166.     int len = ::GetWindowTextLength(fHWnd);
  167.     char *windowText = new char[len + 1];
  168.     ::GetWindowText(fHWnd, windowText, len);
  169.     
  170.     text.ReplaceAll(windowText);
  171.     delete [] windowText;
  172. }
  173.  
  174. //----------------------------------------------------------------------------------------
  175. // FW_CPrivWinControlHelper::HWNDToHelper
  176. //----------------------------------------------------------------------------------------
  177.  
  178. FW_CPrivWinControlHelper* FW_CPrivWinControlHelper::HWNDToHelper(HWND hWnd)
  179. {
  180.     return (FW_CPrivWinControlHelper *) ::SendMessage(hWnd, WM_ODFGETOBJECT, 0, 0);
  181. }
  182.  
  183. //========================================================================================
  184. // CLASS FW_CPrivWinScrollBarHelper
  185. //========================================================================================
  186.  
  187. FW_SPrivWinSuperClassInfo FW_CPrivWinScrollBarHelper::fSuperClassInfo =
  188. {
  189.     "FW_SCROLLBAR", "SCROLLBAR", FW_CPrivWinScrollBarHelper::WindowProc, NULL, 0
  190. };
  191.  
  192. FW_DEFINE_CLASS_M1(FW_CPrivWinScrollBarHelper, FW_CPrivWinControlHelper)
  193.  
  194. //----------------------------------------------------------------------------------------
  195. // FW_CPrivWinScrollBarHelper::FW_CPrivWinScrollBarHelper
  196. //----------------------------------------------------------------------------------------
  197.  
  198. FW_CPrivWinScrollBarHelper::FW_CPrivWinScrollBarHelper(Environment* ev,
  199.                                                         const FW_CClassInfo& classInfo,
  200.                                                        FW_CScrollBar* scrollBar) :
  201.     FW_CPrivWinControlHelper(ev, classInfo, scrollBar)
  202. {
  203.     CheckForInitialize(ev, classInfo);
  204. }
  205.  
  206. //----------------------------------------------------------------------------------------
  207. // FW_CPrivWinScrollBarHelper::~FW_CPrivWinScrollBarHelper
  208. //----------------------------------------------------------------------------------------
  209.  
  210. FW_CPrivWinScrollBarHelper::~FW_CPrivWinScrollBarHelper()
  211. {
  212. }
  213.  
  214. //----------------------------------------------------------------------------------------
  215. // FW_CPrivWinScrollBarHelper::Initialize
  216. //----------------------------------------------------------------------------------------
  217.  
  218. void FW_CPrivWinScrollBarHelper::Initialize(Environment* ev)
  219. {
  220.     FW_CPrivWinControlHelper::Initialize(ev);
  221.     
  222.     FW_CScrollBar* scrollBar = FW_DYNAMIC_CAST(FW_CScrollBar, GetGadget());
  223.     FW_ASSERT(scrollBar);
  224.     
  225.     SetScrollRange(FW_CScrollBar::kDefaultScrollMin, FW_CScrollBar::kDefaultScrollMax);
  226.     SetScrollPos(FW_CScrollBar::kDefaultScrollPos);
  227. }
  228.  
  229. //----------------------------------------------------------------------------------------
  230. // FW_CPrivWinScrollBarHelper::CreateHWnd
  231. //----------------------------------------------------------------------------------------
  232.  
  233. HWND FW_CPrivWinScrollBarHelper::CreateHWnd(HWND parent,
  234.                                             const FW_SPlatformPoint& location,
  235.                                             const FW_SPlatformPoint& size)
  236. {
  237.     DWORD orientation = size.x > size.y ? SBS_HORZ : SBS_VERT;
  238.     
  239. #ifdef FW_BUILD_WIN16
  240.     return ::CreateWindow("FW_SCROLLBAR", "", orientation | WS_CHILD | WS_VISIBLE,
  241.                            location.x, location.y,
  242.                            size.x, size.y,
  243.                            parent, 100,
  244.                            ::GetWindowWord(parent, GWW_HINSTANCE),
  245.                            this);
  246. #endif
  247.  
  248. #ifdef FW_BUILD_WIN32
  249.     return ::CreateWindow("FW_SCROLLBAR", "", orientation | WS_CHILD | WS_VISIBLE,
  250.                            location.x, location.y,
  251.                            size.x, size.y,
  252.                            parent, 
  253.                            (HMENU)100,
  254.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE),
  255.                            this);
  256. #endif
  257. }
  258.  
  259. //----------------------------------------------------------------------------------------
  260. // FW_CPrivWinScrollBarHelper::HandleScrollMessage
  261. //----------------------------------------------------------------------------------------
  262.  
  263. void FW_CPrivWinScrollBarHelper::HandleScrollMessage(WORD sbCode, WORD currentPosition)
  264. {
  265.     Environment* ev = somGetGlobalEnvironment();
  266.     
  267.     FW_CScrollBar* scrollBar = FW_DYNAMIC_CAST(FW_CScrollBar, GetGadget());
  268.     FW_ASSERT(scrollBar);
  269.     
  270.     FW_Fixed changeBy = ff(0);
  271.  
  272.     switch (sbCode)
  273.     {
  274.         case SB_BOTTOM:
  275.             changeBy = scrollBar->GetScrollMax(ev) - ff(GetScrollPos());
  276.             break;
  277.         case SB_TOP:
  278.             changeBy = scrollBar->GetScrollMin(ev) - ff(GetScrollPos());
  279.             break;
  280.         case SB_LINEDOWN:
  281.             changeBy = scrollBar->GetMinorScrollUnits(ev);
  282.             break;
  283.         case SB_LINEUP:
  284.             changeBy = -scrollBar->GetMinorScrollUnits(ev);
  285.             break;
  286.         case SB_PAGEDOWN:
  287.             changeBy = scrollBar->GetMajorScrollUnits(ev);
  288.             break;
  289.         case SB_PAGEUP:
  290.             changeBy = -scrollBar->GetMajorScrollUnits(ev);
  291.             break;
  292.         case SB_THUMBPOSITION:
  293.             changeBy = ff(currentPosition - GetScrollPos());
  294.             break;
  295.     };
  296.     
  297.     FW_Fixed oldValue = ff(GetScrollPos()) - scrollBar->GetScrollMin(ev);
  298.     FW_Fixed newValue = oldValue + changeBy;
  299.     
  300.     if (newValue < scrollBar->GetScrollMin(ev))
  301.         newValue = scrollBar->GetScrollMin(ev);
  302.     else if (newValue > scrollBar->GetScrollMax(ev))
  303.         newValue = scrollBar->GetScrollMax(ev);
  304.     
  305.     newValue += scrollBar->GetScrollMin(ev);
  306.     
  307.     SetScrollPos(FixedToInt(newValue));
  308.     
  309.     scrollBar->ScrollPositionChanged(ev, newValue, newValue - oldValue);
  310. }
  311.  
  312. //----------------------------------------------------------------------------------------
  313. // FW_CPrivWinScrollBarHelper::GetSuperClassInfo
  314. //----------------------------------------------------------------------------------------
  315.  
  316. FW_SPrivWinSuperClassInfo& FW_CPrivWinScrollBarHelper::GetSuperClassInfo() const
  317. {
  318.     return fSuperClassInfo;
  319. }
  320.  
  321. //----------------------------------------------------------------------------------------
  322. // FW_CPrivWinScrollBarHelper::WindowProc
  323. //----------------------------------------------------------------------------------------
  324.  
  325. LRESULT CALLBACK FW_CPrivWinScrollBarHelper::WindowProc(HWND hWnd, UINT msg,
  326.                                                         WPARAM wParam, LPARAM lParam)
  327. {
  328.     switch (msg)
  329.     {
  330.         case WM_CREATE:
  331.             ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  332.                               hWnd, msg, wParam, lParam);
  333.             
  334.             // The FW_CPrivWinScrollBarHelper object is passed in to CreateWindow. Pull it
  335.             // out and stuff it in Window extra bytes.
  336.             
  337.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes,
  338.                             (long) ((LPCREATESTRUCT)lParam)->lpCreateParams);
  339.             return 0L;
  340.             
  341.         case WM_PAINT:
  342.             break;
  343.             
  344.         case WM_DESTROY:
  345.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes, 0L);
  346.             break;
  347.         
  348.         default:
  349.             // Get the Window extra bytes, which is the FW_CPrivWinScrollBarHelper object
  350.             // for this window, and return it.
  351.             
  352.             if (msg == WM_ODFGETOBJECT)
  353.                 return ::GetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes);
  354.     }
  355.  
  356.     return ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  357.                              hWnd, msg, wParam, lParam);    
  358. }
  359.  
  360. //========================================================================================
  361. // CLASS FW_CPrivWinButtonHelper
  362. //========================================================================================
  363.  
  364. FW_SPrivWinSuperClassInfo FW_CPrivWinButtonHelper::fSuperClassInfo =
  365. {
  366.     "FW_BUTTON", "BUTTON", FW_CPrivWinButtonHelper::WindowProc, NULL, 0
  367. };
  368.  
  369. FW_DEFINE_CLASS_M1(FW_CPrivWinButtonHelper, FW_CPrivWinControlHelper)
  370.  
  371. //----------------------------------------------------------------------------------------
  372. // FW_CPrivWinButtonHelper::FW_CPrivWinButtonHelper
  373. //----------------------------------------------------------------------------------------
  374.  
  375. FW_CPrivWinButtonHelper::FW_CPrivWinButtonHelper(Environment* ev,
  376.                                                 const FW_CClassInfo& classInfo,
  377.                                                  FW_CButton* button) :
  378.     FW_CPrivWinControlHelper(ev, classInfo, button)
  379. {
  380.     CheckForInitialize(ev, classInfo);
  381. }
  382.  
  383. //----------------------------------------------------------------------------------------
  384. // FW_CPrivWinButtonHelper::~FW_CPrivWinButtonHelper
  385. //----------------------------------------------------------------------------------------
  386.  
  387. FW_CPrivWinButtonHelper::~FW_CPrivWinButtonHelper()
  388. {
  389. }
  390.  
  391. //----------------------------------------------------------------------------------------
  392. // FW_CPrivWinButtonHelper::GetSuperClassInfo
  393. //----------------------------------------------------------------------------------------
  394.  
  395. FW_SPrivWinSuperClassInfo& FW_CPrivWinButtonHelper::GetSuperClassInfo() const
  396. {
  397.     return fSuperClassInfo;
  398. }
  399.  
  400. //----------------------------------------------------------------------------------------
  401. // FW_CPrivWinButtonHelper::WindowProc
  402. //----------------------------------------------------------------------------------------
  403.  
  404. LRESULT CALLBACK FW_CPrivWinButtonHelper::WindowProc(HWND hWnd, UINT msg,
  405.                                                      WPARAM wParam, LPARAM lParam)
  406. {
  407.     switch (msg)
  408.     {
  409.         case WM_CREATE:
  410.             ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  411.                               hWnd, msg, wParam, lParam);
  412.             
  413.             // The FW_CPrivWinPushButtonHelper object is passed in to CreateWindow. Pull it
  414.             // out and stuff it in Window extra bytes.
  415.             
  416.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes,
  417.                             (long) ((LPCREATESTRUCT)lParam)->lpCreateParams);
  418.             return 0L;
  419.             
  420.         case WM_PAINT:
  421.             break;
  422.             
  423.         case WM_DESTROY:
  424.             ::SetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes, 0L);
  425.             break;
  426.         
  427.         default:
  428.             // Get the Window extra bytes, which is the FW_CPrivWinPushButtonHelper object
  429.             // for this window, and return it.
  430.             
  431.             if (msg == WM_ODFGETOBJECT)
  432.                 return ::GetWindowLong(hWnd, fSuperClassInfo.fWndExtraBytes);
  433.     }
  434.  
  435.     return ::CallWindowProc((WNDPROC) fSuperClassInfo.fOldWndProc,
  436.                              hWnd, msg, wParam, lParam);    
  437. }
  438.  
  439. //========================================================================================
  440. // CLASS FW_CPrivWinPushButtonHelper
  441. //========================================================================================
  442.  
  443. FW_DEFINE_CLASS_M1(FW_CPrivWinPushButtonHelper, FW_CPrivWinButtonHelper)
  444.  
  445. //----------------------------------------------------------------------------------------
  446. // FW_CPrivWinPushButtonHelper::FW_CPrivWinPushButtonHelper
  447. //----------------------------------------------------------------------------------------
  448.  
  449. FW_CPrivWinPushButtonHelper::FW_CPrivWinPushButtonHelper(Environment* ev,
  450.                                                          const FW_CClassInfo& classInfo,
  451.                                                          FW_CPushButton* button) :
  452.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  453. {
  454.     CheckForInitialize(ev, classInfo);
  455. }
  456.  
  457. //----------------------------------------------------------------------------------------
  458. // FW_CPrivWinPushButtonHelper::~FW_CPrivWinPushButtonHelper
  459. //----------------------------------------------------------------------------------------
  460.  
  461. FW_CPrivWinPushButtonHelper::~FW_CPrivWinPushButtonHelper()
  462. {
  463. }
  464.  
  465. //----------------------------------------------------------------------------------------
  466. // FW_CPrivWinPushButtonHelper::CreateHWnd
  467. //----------------------------------------------------------------------------------------
  468.  
  469. HWND FW_CPrivWinPushButtonHelper::CreateHWnd(HWND parent,
  470.                                              const FW_SPlatformPoint& location,
  471.                                              const FW_SPlatformPoint& size)
  472. {
  473. #ifdef FW_BUILD_WIN16
  474.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE,
  475.                            location.x, location.y,
  476.                            size.x, size.y,
  477.                            parent, 100,
  478.                            ::GetWindowWord(parent, GWW_HINSTANCE),
  479.                            this);
  480. #endif 
  481.  
  482. #ifdef FW_BUILD_WIN32
  483.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE,
  484.                            location.x, location.y,
  485.                            size.x, size.y,
  486.                            parent, 
  487.                            (HMENU)100,
  488.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE),
  489.                            this);
  490. #endif 
  491. }
  492.  
  493. //----------------------------------------------------------------------------------------
  494. // FW_CPrivWinPushButtonHelper::MakeDefaultButton
  495. //----------------------------------------------------------------------------------------
  496.  
  497. void FW_CPrivWinPushButtonHelper::MakeDefaultButton(FW_Boolean isDefault)
  498. {
  499.     unsigned long dwStyle = (unsigned long)(::GetWindowLong(fHWnd, GWL_STYLE));
  500.  
  501.     if (isDefault)                            // Make sure the button's style has BS_DEFPUSHBUTTON
  502.     {
  503.         if ((dwStyle & 0xFFL) == BS_DEFPUSHBUTTON)
  504.             return;
  505.  
  506.         dwStyle |= BS_DEFPUSHBUTTON;
  507.     }
  508.     else                                    // Make sure the button's style doesn't have
  509.         {                                    // BS_DEFPUSHBUTTON
  510.  
  511.             if (!((dwStyle & 0xFFL) == BS_DEFPUSHBUTTON))
  512.                 return;
  513.  
  514.             dwStyle &= ~BS_DEFPUSHBUTTON;
  515.         }
  516.  
  517.     ::SetWindowLong(fHWnd, GWL_STYLE, dwStyle);
  518. }
  519. //----------------------------------------------------------------------------------------
  520. // FW_CPrivWinPushButtonHelper::HandleButtonMessage
  521. //----------------------------------------------------------------------------------------
  522.  
  523. void FW_CPrivWinPushButtonHelper::HandleButtonMessage()
  524. {
  525.     FW_CPushButton* button = FW_DYNAMIC_CAST(FW_CPushButton, GetGadget());
  526.     FW_ASSERT(button);
  527.     
  528.     button->ButtonPressed(somGetGlobalEnvironment());
  529. }
  530.  
  531. //========================================================================================
  532. // CLASS FW_CPrivWinRadioButtonHelper
  533. //========================================================================================
  534.  
  535. FW_DEFINE_CLASS_M1(FW_CPrivWinRadioButtonHelper, FW_CPrivWinButtonHelper)
  536.  
  537. //----------------------------------------------------------------------------------------
  538. // FW_CPrivWinRadioButtonHelper::FW_CPrivWinRadioButtonHelper
  539. //----------------------------------------------------------------------------------------
  540.  
  541. FW_CPrivWinRadioButtonHelper::FW_CPrivWinRadioButtonHelper(Environment* ev,
  542.                                                             const FW_CClassInfo& classInfo,
  543.                                                              FW_CRadioButton* button) :
  544.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  545. {
  546.     CheckForInitialize(ev, classInfo);
  547. }
  548.  
  549. //----------------------------------------------------------------------------------------
  550. // FW_CPrivWinRadioButtonHelper::~FW_CPrivWinRadioButtonHelper
  551. //----------------------------------------------------------------------------------------
  552.  
  553. FW_CPrivWinRadioButtonHelper::~FW_CPrivWinRadioButtonHelper()
  554. {
  555. }
  556.  
  557. //----------------------------------------------------------------------------------------
  558. // FW_CPrivWinRadioButtonHelper::CreateHWnd
  559. //----------------------------------------------------------------------------------------
  560.  
  561. HWND FW_CPrivWinRadioButtonHelper::CreateHWnd(HWND parent,
  562.                                              const FW_SPlatformPoint& location,
  563.                                              const FW_SPlatformPoint& size)
  564. {
  565. #ifdef FW_BUILD_WIN16
  566.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  567.                            location.x, location.y,
  568.                            size.x, size.y,
  569.                            parent, 100,
  570.                            ::GetWindowWord(parent, GWW_HINSTANCE), 
  571.                            this);
  572. #endif
  573. #ifdef FW_BUILD_WIN32
  574.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_RADIOBUTTON,
  575.                            location.x, location.y,
  576.                            size.x, size.y,
  577.                            parent, 
  578.                            (HMENU)100,
  579.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE), 
  580.                            this);
  581. #endif
  582. }
  583.  
  584. //----------------------------------------------------------------------------------------
  585. // FW_CPrivWinRadioButtonHelper::HandleButtonMessage
  586. //----------------------------------------------------------------------------------------
  587.  
  588. void FW_CPrivWinRadioButtonHelper::HandleButtonMessage()
  589. {
  590.     FW_CRadioButton* button = FW_DYNAMIC_CAST(FW_CRadioButton, GetGadget());
  591.     FW_ASSERT(button);
  592.     
  593.     button->ButtonPressed(somGetGlobalEnvironment());
  594. }
  595.  
  596. //========================================================================================
  597. // CLASS FW_CPrivWinRadioClusterHelper
  598. //========================================================================================
  599.  
  600. FW_DEFINE_CLASS_M1(FW_CPrivWinRadioClusterHelper, FW_CPrivWinButtonHelper)
  601.  
  602. //----------------------------------------------------------------------------------------
  603. // FW_CPrivWinRadioClusterHelper::FW_CPrivWinRadioClusterHelper
  604. //----------------------------------------------------------------------------------------
  605.  
  606. FW_CPrivWinRadioClusterHelper::FW_CPrivWinRadioClusterHelper(Environment* ev,
  607.                                                             const FW_CClassInfo& classInfo,
  608.                                                              FW_CRadioButton* button) :
  609.     FW_CPrivWinButtonHelper(ev, classInfo, button)
  610. {
  611.     CheckForInitialize(ev, classInfo);
  612. }
  613.  
  614. //----------------------------------------------------------------------------------------
  615. // FW_CPrivWinRadioClusterHelper::~FW_CPrivWinRadioClusterHelper
  616. //----------------------------------------------------------------------------------------
  617.  
  618. FW_CPrivWinRadioClusterHelper::~FW_CPrivWinRadioClusterHelper()
  619. {
  620. }
  621.  
  622. //----------------------------------------------------------------------------------------
  623. // FW_CPrivWinRadioClusterHelper::CreateHWnd
  624. //----------------------------------------------------------------------------------------
  625.  
  626. HWND FW_CPrivWinRadioClusterHelper::CreateHWnd(HWND parent,
  627.                                              const FW_SPlatformPoint& location,
  628.                                              const FW_SPlatformPoint& size)
  629. {
  630. #ifdef FW_BUILD_WIN16
  631.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
  632.                            location.x, location.y,
  633.                            size.x, size.y,
  634.                            parent, 100,
  635.                            ::GetWindowWord(parent, GWW_HINSTANCE), this);
  636. #endif
  637. #ifdef FW_BUILD_WIN32
  638.     return ::CreateWindow("FW_BUTTON", "", WS_CHILD | WS_VISIBLE | BS_GROUPBOX,
  639.                            location.x, location.y,
  640.                            size.x, size.y,
  641.                            parent, 
  642.                            (HMENU)100,
  643.                            (HINSTANCE)::GetWindowLong(parent, GWL_HINSTANCE), 
  644.                            this);
  645. #endif
  646. }
  647.  
  648. //----------------------------------------------------------------------------------------
  649. // FW_CPrivWinRadioClusterHelper::HandleButtonMessage
  650. //----------------------------------------------------------------------------------------
  651.  
  652. void FW_CPrivWinRadioClusterHelper::HandleButtonMessage()
  653. {
  654.     FW_CRadioCluster* button = FW_DYNAMIC_CAST(FW_CRadioCluster, GetGadget());
  655.     FW_ASSERT(button);
  656.     
  657. //    button->ButtonPressed();
  658. }
  659.  
  660. #endif
  661.